package com.my.mybits.mapper;

import com.my.mybits.po.Course;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

public interface CourseMapper {
//    Course findCourseByCourseId(int courseId);
    Course findCourseByCourseIdEx(Integer courseId);

    @Select("select * from course where course_id=#{courseId}")
    @Results({@Result(id = true, property = "courseId", column = "course_id"),
            @Result(property = "book", column = "course_id", one = @One(
                    select = "com.my.mybits.mapper.BookMapper.findBookByCourseId"))})
    Course findCourseByCourseId(int courseId);
}
